package com.wc.AlgoOJ_homework.AlgoOJ_HomeWork1.G_单词分析;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/1/20 14:07
 * @description http://43.138.190.70:8888/p/177
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int[] letNum = new int[128];
        char ansCh = 127;
        int cnt = 0;
        for (char ch : s.toCharArray()) {
            letNum[ch]++;
            if (letNum[ch] > cnt) {
                ansCh = ch;
                cnt = letNum[ch];
            } else if (letNum[ch] == cnt) {
                if (ch < ansCh) {
                    ansCh = ch;
                }
            }
        }
        System.out.println(ansCh);
        System.out.println(cnt);
    }
}